//
//  FeedbackView.swift
//  KoiAccounting
//
//  Created by 纪洪文 on 12.04.25.
//

import SwiftUI

struct FeedbackView: View {
    
    private var user = KoiAccountingUserManager.standard.user()
    
    @State var url = "https://support.qq.com/product/663524"
    
    var postData: Data? = nil
    
    init() {
        var postString = ""
        if let uid = user?.uid {
            postString = "openid=\(uid)"
        }
        if let nickname = user?.getNickname() {
            postString.append("&nickname=\(nickname)")
        }
        
        postString.append("&avatar=\(user.getHeadImg())")
        
        postData = postString.data(using: .utf8)
    }
    
    var body: some View {
        VStack {
            KoiWebView(url: url, postData: postData)
        }
        .koiToolbar(title: Text("意见反馈"))
    }
}

#Preview {
    FeedbackView()
}
